<template>
  <div class="background">
    <el-row :gutter="20">
      <el-col :span="4"></el-col>
      <el-col :span="16">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <div>
                <span class="title">投诉举报</span>
              </div>
              <button class="button" @click="report">提交</button>
            </div>
          </template>
          <div class="rightInfo">
            <!-- 【！要求！】 -->
            <!--  -->
            <div class="details">
              <h3 class="subtitle">说明：</h3>
              <p>
                由于本网站属于学生作业，您的举报有可能不能及时被处理，如若您希望加急处理，我们推荐您拨打：18035701865，项目负责人将会与您沟通。我们所有信息都是实名制，请您放心。
              </p>
              <h3 class="subtitle">您要举报订单的标题全称：</h3>
              <el-input v-model="title" placeholder="Please input" />
              <h3 class="subtitle">情况描述：</h3>
              <el-input
                v-model="describe"
                :autosize="{ minRows: 2, maxRows: 4 }"
                type="textarea"
                placeholder="Please input"
              />

              <h3 class="subtitle">您的称呼：</h3>
              <el-input v-model="name" placeholder="Please input" />
              <h3 class="subtitle">联系方式：</h3>
              <p><el-input v-model="phone" placeholder="Please input" /></p>
            </div>
            <div style="margin: 20px 0" />
            <div style="margin: 20px 0" />
            <div class="details">
              <h3 class="subtitle">感谢您的使用，我们将竭诚为您解忧！</h3>
            </div>
          </div>
        </el-card></el-col
      >
      <el-col :span="4"></el-col>
    </el-row>
  </div>
</template>
<script>
import { ElMessage } from "element-plus";

export default {
  data() {
    return {
      title: "",
      describe: "",
      name: "",
      phone: "",
    };
  },
  methods: {
    report() {
      if (
        this.title === "" &&
        this.describe === "" &&
        this.phone === "" &&
        this.name === ""
      ) {
        ElMessage({
          message: "请输入举报信息",
          type: "warning",
        });
      } else {
        const params = new URLSearchParams();
        params.append("title", this.title);
        params.append("describe", this.describe);
        params.append("phone", this.phone);
        params.append("name", this.name);
        this.axios.post("http://127.0.0.1:8000/report/", params).then((res) => {
          this.data = res.data.data;
          if (res.data.success) {
            ElMessage({
              message: "举报成功，请耐心等待回访~",
              type: "success",
            });
          }
        });
      }
    },
  },
};
</script>
<style scoped>
.button {
  display: inline-block;
  border-radius: 4px;
  background-color: #666699;
  border: none;
  color: #ffffff;
  text-align: center;
  font-size: 13px;
  padding: 10px;
  width: 100px;
  transition: all 0.5s;
  cursor: pointer;
  margin: 5px;
}

.button span {
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: 0.5s;
}

.button span:after {
  content: "»";
  position: absolute;
  opacity: 0;
  top: 0;
  right: -20px;
  transition: 0.5s;
}

.button:hover span {
  padding-right: 25px;
}

.button:hover span:after {
  opacity: 1;
  right: 0;
}
.background {
  background: linear-gradient(rgb(255, 236, 254), white);
  font-family: sans-serif;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.title {
  font-size: 20px;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  letter-spacing: 2px;
  font-weight: bolder;
}

.type {
  padding: 5px 13px;
  background-color: lavender;
  border-radius: 10px;
  margin-left: 13px;
  max-height: 16px;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: bold;
}
.box-card {
  width: 100%;
  margin: 50px 0;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
  background-color: red;
}
/* 发单人 */

.little {
  color: gray;
  font-size: 15px;
}
.rightOwner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.rightOwnerLeft {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.rightOwnerInfo {
  display: flex;
  padding: 10px;
}
.rightOwnerInfo span {
  margin: 0 10px;
}
.rightInfo {
  padding: 3px 20px;
}
.subtitle {
  margin: 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #222;
  line-height: 22px;
}

.details p {
  font-size: 14px;
  color: #222;
  line-height: 24px;
  text-align: justify;
  white-space: pre-wrap;
  word-break: break-all;
}
</style>
